<?php

/*

Equipped Items (battle_items.php)

*/

$rank_check = 1;
$page_title = "Equipped Items";
include "header.inc.php";

if (!$min) { $min = 0; }

$query = mysql_query("SELECT * FROM user_pets2 WHERE owner = '$userid' AND adoption = '0' AND game = '$game' ORDER BY id ASC");

echo $openHTML;
echo "<p>Here is a list of all your pets equipped items. To unequip an item simply click i and it will return to your <a href=myitems.php?game=$game>inventory</a>.</p>";

$x = 0;
while ($array = mysql_fetch_array($query))
{
	$id = $array[id];
	$getPet = fetch("SELECT * FROM pets2 WHERE id = '$array[species]' AND game = '$game'");

	print "
	<p align=center>
	<img src=$base_url/images/user_images/opg_$game/pets/pet_$getPet[id].gif>
	<br><b>$array[name]</b> the $getPet[name]!</p><p align=center>Equipped Items:</p>";

	$findWeapons = mysql_query("SELECT * FROM equipped_items2 WHERE pet_id = '$array[id]' AND game = '$game'");
	$numW = mysql_num_rows($findWeapons);
	if ($numW == 0) { print "<p align=center><b>No Equipped Items</b></p>"; }
	$x = 1;
	while ($getWeapons = mysql_fetch_array($findWeapons))
	{
		$get_item = fetch("SELECT * FROM items2 WHERE id = '$getWeapons[item_id]' AND game = '$game'");

		if ($x == 1) { print "<p align=center>"; }
		if ($x <= 6)
		{
			print "<a href=unequip.pro.php?game=$game&itemid=$getWeapons[id]><img src=images/user_images/opg_$game/items/item_$get_item[id].gif border=1></a>";
		}
		if ($x == 6) { print "</p>"; $x = 0; }
		$x++;
	}

	print "<hr width=450>";
}

echo $closeHTML;

?>